module.exports = {
  /*
  ** Headers of the page
  */
  head: {
    title: '最好的商城',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: '最好的商城门户网站', name: '最好的商城门户网站', content: '最好的商城门户网站' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },
  /*
  ** Customize the progress bar color
  */
  loading: { color: '#3B8070' },
  /*
  ** Build configuration
  */
  build: {
    /*
    ** Run ESLint on save
    */
    extend (config, { isDev, isClient }) {
      if (isDev && isClient) {
        config.module.rules.push({
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/
        })
      }
    }
  },
  /*
  * 引入插件的js
  * */
  plugins: [
    { src: '~plugins/element-ui.js', ssr: false },
    { src: "~/plugins/vue-swiper.js", ssr: false }
  ],
  /*
  * 引入插件的css
  * */
  css: [
    { src:'element-ui/lib/theme-chalk/index.css' },
    { src: "swiper/css/swiper.css" },
  ],
  /*
  * 跨域代理插件
  * */
  modules: [
    '@gauseen/nuxt-proxy'
  ],
  /**
   * 拦截请求，并代理到目标地址
   * 如请求：/api/getAll
   * 代理后：http://localhost:8000/api/getAll
   */
  proxyTable: {
    '/api':{ //拦截以api开头的接口请求
      target: 'http://localhost:8000',
      changeOrigin:true, //是否跨域
      ws: false, // 是否支持websocket
      pathRewrite: { '^/api': '/api' } //拦截以api开头的接口请求，重写成以api开头（这个是后台服务的请求开头）的新请求
    }
  },
}
